﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MoroMoro.Samples.ToDoList.Presentation.Views
{
    /// <summary>
    /// このアプリケーション内におけるフォーム基本クラスです。
    /// </summary>
    public partial class MyForm : Form, IView
    {
        /// <summary>
        /// <see cref="MyForm"/> クラスの新しいインスタンスを初期化します。
        /// </summary>
        public MyForm()
        {
            InitializeComponent();
        }


        /// <inheritdoc/>
        event EventHandler IView.Load
        {
            add
            {
                Load += value;
            }
            remove
            {
                Load -= value;
            }
        }

        /// <inheritdoc/>
        event CancelEventHandler IView.Closing
        {
            add
            {
                Closing += value;
            }
            remove
            {
                Closing -= value;
            }
        }


        /// <inheritdoc/>
        void IView.ShowInfoMessageBox(string text)
        {
            MessageBox.Show(this, text, "情報", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        /// <inheritdoc/>
        void IView.ShowWarningMessageBox(string text)
        {
            MessageBox.Show(this, text, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }

        /// <inheritdoc/>
        void IView.ShowErrorMessageBox(string text)
        {
            MessageBox.Show(this, text, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

        /// <inheritdoc/>
        DialogResult IView.ShowOkCancelMessageBox(string text, MessageBoxDefaultButton defaultButton)
        {
            return MessageBox.Show(this, text, "確認", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, defaultButton);
        }

        /// <inheritdoc/>
        DialogResult IView.ShowYesNoMessageBox(string text, MessageBoxDefaultButton defaultButton)
        {
            return MessageBox.Show(this, text, "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question, defaultButton);
        }

        /// <inheritdoc/>
        DialogResult IView.ShowMessageBox(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
        {
            return MessageBox.Show(this, text, caption, buttons, icon, defaultButton);
        }
    }
}
